﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rj_GsInsurance.Server.Extensions;
using Rj_GsInsurance.Server.Utils;
using static System.Runtime.CompilerServices.RuntimeHelpers;

namespace Rj_GsInsurance.Server.Models
{
    public class InsurContext<In,Out>
    {
        public InsurMsgIn<In> InsurMsgReq { get; set; }
        public InsurMsgOut<Out> InsurMsgResp { get; set; }
    }

    public class InsurMsgIn<In>: IInsurMsg<In>
    {
        public string ywbh { get; set; }
        public string gsxyjgbh { get; set; }
        public string czybh { get; set; }
        public string ywzqh { get; set; }
        public string gsxyjgjylsh { get; set; }
        public string zxbm { get; set; }
        public In input { get; set; }
        public string ljbz { get; set; }


        public InsurMsgOut<Out> Excute<Out>()
        {
            string strInput=this.SerializerInsurMsg();
            if(!GSInsuraceHelper.Si_Busi_Handle(strInput,out string strOutput))
            {
                throw new Exception(strOutput);
            }
            return InsurMsgExtensions.DeserializeInsurMsg<Out>(strOutput);
        }
    }

    public class InsurMsgOut<Out>: IInsurMsg<Out>
    {
        public string zxjylsh { get; set; }
        public string ltjbz { get; set; }
        public Out output { get; set; }
        public string jgxx { get; set; }
    }
}
